//
//  JYSearchListController.m
//  JYFarm
//
//  Created by 花花 on 2017/10/20.
//  Copyright © 2017年 花花. All rights reserved.
//

#import "JYSearchListController.h"
#import "JYPublicCell.h"
@interface JYSearchListController ()

@end

static NSString *const SearchListCellID = @"SearchListCellID";
@implementation JYSearchListController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor yellowColor];
    
    [self setupTableView];
}
- (void)viewWillDisappear:(BOOL)animated
{
    
    NSLog(@"%s",__func__);
    [super viewWillDisappear:animated];
  
    [[NSNotificationCenter defaultCenter]postNotificationName:kSaveHistoryItemSuccessNotification object:nil];
}



- (void)setupTableView{


    [self.tableView registerNib:[UINib nibWithNibName:@"JYPublicCell" bundle:nil] forCellReuseIdentifier:SearchListCellID];
    self.tableView.rowHeight = 85;

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return 20;

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    
    JYPublicCell *cell =[tableView dequeueReusableCellWithIdentifier:SearchListCellID];
    
        cell.nameLabel.text = [NSString stringWithFormat:@"有机空心心心菜有机空心心心菜%zd",arc4random_uniform(50)];
        cell.count.text = [NSString stringWithFormat:@"%zd",arc4random_uniform(44)];
        cell.imgView.image = [UIImage imageNamed:@"home_icon_wine"];
        cell.priceLabel.text = [NSString stringWithFormat:@"￥%zd/个",arc4random_uniform(150)];
        cell.oldPriceLabel.text = [NSString stringWithFormat:@"￥%zd",arc4random_uniform(100000)];
    
    return cell;

}


@end
